<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    let str = 'abcdef';
    let char = 'f';

    /* 需求：判断某个字符是否在另外一个字符串里面 */

    console.log(str.indexOf(char)); //5

    // es6里面新增 includes 翻译过来包含
    console.log(str.includes(char)); // true
    /* es6 以字符开头 startsWith*/
    console.log(str.startsWith('a1'));
    /* es6以字符结尾 endsWith */
    console.log(str.endsWith('m'));





</script>

</html>